<!-- 所有定时设置 -->
<template>
    <div style="padding: 0 10px 10px 10px">
        <navigationBarCustom customTitle="所有定时设置">
            <div class="searchContent">
                <el-input v-model="planName" placeholder="请输入设置名称" size="mini" style="width: 150px; margin-right: 10px"></el-input>
                <custom-button type="search" style="margin-right: 10px" @searchClick="searchClick"></custom-button>
                <custom-button type="reset" style="margin-right: 10px" @resetClick="resetClick"></custom-button>
            </div>
        </navigationBarCustom>

        <div style="margin-top: 10px" :key="randomKey">
            <tableHeightIndex
                :dataSource="dataSource"
                :tableColumns="tableColumns"
                :btnList="btnList"
                :pageSize="pageSize"
                :pageCount="pageCount"
                :pageNo="pageNo"
                @pageChange="pageChange"
                @editRow="editRow"
                @useDetailRow="useDetailRow"
                @supplementCopyingRow="supplementCopyingRow"
                @timedConfigurationRow="timedConfigurationRow"
                @deleteRow="deleteTableRow"
                :selection="false"
                btnListWidth="250"
                :height="tableRealHeight"
            ></tableHeightIndex>
        </div>
    </div>
</template>

<script>
import tableHeightIndex from '@/components/customComponents/customeTable/tableHeightIndex.vue'
import customButton from '@/components/customComponents/customForm/customButton'
import navigationBarCustom from '@/components/customComponents/managementCenter/navigationBarCustom.vue'
import {PopupCommon} from '@/libs/popupCommon'
import {dsSetList} from '@/mockData/controlCenter'

export default {
    name: 'planDeployment',
    components: {
        tableHeightIndex,
        navigationBarCustom,
        customButton
    },
    data() {
        return {
            dialogShow: false,
            randomKey: '1',
            tableRealHeight: document.body.clientHeight - 225,
            planName: '',
            userName: '',
            rangeDate: '',
            secondTableHeight: 400,
            // table 相关参数  begin
            dataSource: [],
            tableColumns: [
                {
                    prop: 'name',
                    label: '定时设置名称'
                },
                {
                    prop: 'item',
                    label: '功能项'
                },
                {
                    prop: 'resetCount',
                    label: '超时重抄次数'
                },
                {
                    prop: 'bds',
                    label: '定时表达式'
                },
                {
                    prop: 'remark',
                    label: '定时描述'
                },
                {
                    prop: 'nextRun',
                    label: '下次运行时间'
                },
                {
                    prop: 'qjds',
                    label: '全局定时',
                    dictName: 'trueOrFalse'
                },
                {
                    prop: 'useCount',
                    label: '使用情况'
                },
                {
                    prop: 'zjyccs',
                    label: '最近异常次数'
                }
            ],
            btnList: ['delete', 'edit', 'useDetail', 'supplementCopying', 'timedConfiguration'],
            pageSize: 20,
            pageCount: 2,
            pageNo: 1
        }
    },
    computed: {},
    created() {},
    mounted() {
        this.$nextTick(() => {
            this.dataSource = dsSetList
        })
    },
    methods: {
        resizeWin() {
            console.log('1111')
            // var myEvent = new Event("resize")
            // window.dispatchEvent(myEvent)
            this.randomKey = Math.random() * 10000000
        },
        deleteTableRow(d) {
            console.log(d)
            PopupCommon.notify('success', '删除成功')
        },
        useDetailRow(d) {
            this.$emit('useDetailRow', d.data)
        },
        timedConfigurationRow(d) {
            this.$emit('timedConfigurationRow', d.data)
        },
        supplementCopyingRow(d) {
            console.log(d)
            PopupCommon.confirm('补抄所有异常任务？')
                .then((result) => {
                    if (result) {
                        PopupCommon.notify('info', '补抄完成')
                    }
                })
                .catch((err) => {
                    console.log(err)
                })
        },
        editTableRow(d) {
            console.log(d)
        },
        editRow(d) {
            this.$emit('editRow', d.data)
        },
        // 分页点击事件
        pageChange(p) {
            this.pageNo = p
            //   this.initPage();
        },
        searchClick() {
            this.pageNo = 1
            // this.initPage()
        },
        resetClick() {
            this.planName = ''
            this.userName = ''
            this.rangeDate = ''
        }
    }
}
</script>

<style lang="scss" scoped>
.flex-right-item {
    width: 100%;
    text-align: right;
}
.title {
    background: #f2f2f2;
    height: 35px;
    line-height: 35px;
    text-align: center;
    margin-bottom: 10px;
}
.mcTableIndex {
    background: #f5f5f5;
    padding: 0;
}
</style>
